<template>
  <div class="cgjhadd">
    <el-form ref="form" :disabled="isdisabled" :model="form" :rules="rules" label-width="20%">
      <div class="contain">
        <div class="left">
          <el-collapse v-model="activeNames">
            <el-collapse-item title="申请信息" name="1" id="shenqing">
              <template v-if="!isZz">
                <el-button
                  type="primary"
                  @click="showChooseEnter=true"
                  style="margin-bottom: 20px;margin-left: 20px;"
                  size="mini"
                >选择企业
                </el-button>
                <el-button
                  type="info"
                  plain
                  @click="cancelChooseEnter()"
                  style="margin-bottom: 20px;margin-left: 20px;"
                  size="mini"
                >取消选择
                </el-button>
              </template>

              <div class="form-box">
                <el-form-item label="企业名称" prop="enterpriseName">
                  <el-input
                    v-model="form.enterprise.enterpriseName"
                    :disabled="!isEmpty(chooseEnterTem)||isZz"
                    placeholder="请输入企业名称"
                  />
                </el-form-item>
                <el-form-item label="企业法人" prop="legalPerson">
                  <el-input
                    :disabled="isZz"
                    v-model="form.enterprise.legalPerson"
                    placeholder="请输入企业法人"
                  />
                </el-form-item>
                <el-form-item label="法人联系电话" prop="legalPhone">
                  <el-input
                    :disabled="isZz"
                    v-model="form.enterprise.legalPhone"
                    placeholder="请输入法人联系电话"
                  />
                </el-form-item>
                <el-form-item label="企业联系人" prop="enterpriseContact">
                  <el-input
                    v-model="form.enterprise.enterpriseContact"
                    :disabled="!isEmpty(chooseEnterTem)||isZz"
                    placeholder="请输入企业联系人"
                  />
                </el-form-item>
                <el-form-item label="企业联系人电话" prop="contactPhone">
                  <el-input
                    v-model="form.enterprise.contactPhone"
                    :disabled="!isEmpty(chooseEnterTem)||isZz"
                    placeholder="请输入企业联系人电话"
                  />
                </el-form-item>


                <el-form-item label="备注" prop="remark">
                  <el-input
                    :disabled="isZz"
                    v-model="form.remark"
                    type="textarea"
                    placeholder="请输入内容"
                  />
                </el-form-item>
              </div>
            </el-collapse-item>
            <el-collapse-item title="租赁信息" name="2" id="zulin">
              <div class="form-box">
                <el-form-item label="开始时间" prop="beginTime">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feApartment.beginTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="结束时间" prop="endTime">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feApartment.endTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择结束时间"
                  >
                  </el-date-picker>
                </el-form-item>
<!--                <el-form-item label="开始免租时间" prop="rentFreeBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feApartment.rentFreeBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开始免租时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="免租结束时间" prop="rentFreeEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feApartment.rentFreeEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择免租结束时间"
                  >
                  </el-date-picker>
                </el-form-item>-->
                <el-form-item label="租赁模式" prop="feApartment.leaseModel">
                  <el-select clearable v-model="form.feApartment.leaseModel"
                             placeholder="请选择出租模式">
                    <el-option label="按间" value="按间"></el-option>
                    <el-option label="按面积" value="按面积"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="合同总面积(㎡)" v-if="form.feApartment.leaseModel == '按面积'"
                              prop="feApartment.contractArea">
                  <el-input
                    v-model="form.feApartment.contractArea"
                    placeholder="请输入合同总面积(㎡)"/>
                </el-form-item>
                <el-form-item label="租金单价" v-if="form.feApartment.leaseModel == '按面积'" prop="areaPrice">
                  <el-input
                    v-model="form.feApartment.areaPrice"
                    placeholder="请按当前合同面积输入租金单价"/>
                </el-form-item>
                <el-form-item label="物管费单价" v-if="form.feApartment.leaseModel == '按面积'" prop="propertyPrice">
                  <el-input
                    v-model="form.feApartment.propertyPrice"
                    placeholder="请按当前合同面积输入物管费单价"/>
                </el-form-item>
                <el-form-item label="设施使用费单价" v-if="form.feApartment.leaseModel == '按面积'" prop="facilityPrice">
                  <el-input
                    v-model="form.feApartment.facilityPrice"
                    placeholder="请按当前合同面积输入设施使用费单价"/>
                </el-form-item>
                <el-form-item label="收费模式" prop="feApartment.feeModel">
                  <el-select clearable v-model="form.feApartment.feeModel"
                             placeholder="请选择收费模式">
                    <el-option label="按月" value="按月"></el-option>
                    <el-option label="按季度" value="按季度"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="计费类型" prop="calculationMode">
                  <el-select
                    clearable
                    v-model="form.feApartment.calculationMode"
                    placeholder="请选择计费类型">
                    <el-option label="手动计费" value="手动计费"></el-option>
                    <el-option label="自动计费" value="自动计费"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="下期账单时间" prop="nextPropertyDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feApartment.nextPropertyDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择下期账单时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="生效状态" prop="effect">
                  <el-select clearable v-model="form.feApartment.effect"
                             placeholder="请选择生效状态">
                    <el-option label="未生效" value="未生效"></el-option>
                    <el-option label="已生效" value="已生效"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="租赁记录状态" prop="recordState">
                  <el-select
                    clearable
                    v-model="form.recordState"
                    placeholder="请选择租赁记录状态"
                  >
                    <el-option label="未到期" value="未到期"></el-option>
                    <el-option label="已到期" value="已到期"></el-option>
                  </el-select>
                </el-form-item>
              </div>
            </el-collapse-item>
            <!--v-if = "form.feApartment.leaseModel == '0'"-->
            <el-collapse-item title="房源列表" name="3" id="dianjian">
              <div class="form-box1">
                <el-button
                  type="primary"
                  @click="addDevice('buiRoomList')"
                  icon="el-icon-plus"
                  size="mini"
                >选择
                </el-button
                >
                <el-table :data="buiRoomListSelect">
                  <el-table-column
                    label="房源编号"
                    align="center"
                    prop="roomNum"
                  />
                  <el-table-column
                    label="楼栋"
                    align="center"
                    prop="buildingName"
                  />
                  <el-table-column label="楼层" align="center" prop="floor"/>
                  <!--<el-table-column label="园区" align="center" prop="parkName"/>-->

                  <el-table-column
                    label="房源面积(m²)"
                    align="center"
                    prop="builtUpArea"
                  />
                  <el-table-column label="租金/间" align="center" prop="areaPrice">
                    <template slot-scope="scope">
                      <el-input type="number" v-model="scope.row.areaPrice" placeholder="请输入租金"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="物管费/间" align="center" prop="propertyFee">
                    <template slot-scope="scope">
                      <el-input type="number" v-model="scope.row.propertyFee" placeholder="请输入物管费"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="保证金/间" align="center" prop="facilityFee">
                    <template slot-scope="scope">
                      <el-input type="number" v-model="scope.row.facilityFee" placeholder="请输入设施使用费"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        @click="delDevice('buiRoomList', scope.$index)"
                      >删除
                      </el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>
            <el-collapse-item title="附件" name="4" id="fujian">
              <div class="form-box">
                <el-form-item label="附件">
                  <FileUpload ref="fileupload" :fileListTem="form.fileIdList" :fileSize="fileSize" :limit="20"/>
                </el-form-item>
              </div>
            </el-collapse-item>
          </el-collapse>
        </div>
        <div class="right">
          <div class="my-steps-box">
            <div
              :class="['step-item', stepSelect == index ? 'step-active' : '']"
              v-for="(item, index) in step"
              :key="index"
            >
              <div class="top-title" @click="jump(item.to, index)">
                <div class="cricle"></div>
                <span class="text">{{ item.text }}</span>
              </div>
              <div class="line"></div>
            </div>
          </div>
        </div>
      </div>
      <div class="big-foot-fixed">
        <el-button type="primary" @click="submitForm">提交</el-button>
        <el-button @click="cancel">取消</el-button>
      </div>
    </el-form>
    <!-- 选择入驻企业 -->
    <el-dialog title="选择入驻企业" :visible.sync="showChooseEnter">
      <el-select v-model="chooseEnterTem" @change="chooseEnterFn" filterable>
        <el-option :value="item.id" :label="item.enterpriseName" v-for="item in zsCustomerList"
                   :key="item.id"></el-option>
      </el-select>
    </el-dialog>

    <!-- 选择房源 -->
    <el-dialog :title="title" :visible.sync="dialogdeviceVisible">
      <div v-if="typeFee === 'buiRoomList'">
        <el-form
          :model="queryListBuiRoom"
          ref="queryListBuiRoomForm"
          :inline="true"
          label-width="68px"
        >
          <el-form-item label="园区" prop="roomType" label-width="40px">
            <el-select
              style="width: 150px"
              clearable
              v-model="queryListBuiRoom.parkNum"
              placeholder="请选择园区"
            >
              <el-option
                v-for="item in parkList"
                :key="item.id"
                :label="item.parkName"
                :value="item.parkNum"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="楼栋" prop="state" label-width="40px">
            <el-select
              style="width: 150px"
              clearable
              v-model="queryListBuiRoom.buildingNum"
              placeholder="请选择楼栋"
            >
              <el-option
                v-for="item in buildingList"
                :key="item.id"
                :label="item.buildingName"
                :value="item.buildingNum"
              />
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="queryListBuiRoomFn"
            >搜索
            </el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQueryListBuiRoomFn"
            >重置
            </el-button
            >
            <el-button icon="el-icon-plus" size="mini" @click="$router.push('/smartParks/parkAssets/buildingRoom')"
            >添加房源
            </el-button
            >
          </el-form-item>
        </el-form>
        <el-table
          key="buiRoomList"
          ref="buiRoomListRef"
          :data="buiRoomList"
          class="device-style"
          v-loading="loading"
          max-height="250"
          :row-key="getRowKey"
          @selection-change="handleDevice"
        >
          <el-table-column
            v-if="typeFee === 'buiRoomList'"
            type="selection"
            :reserve-selection="true"
            width="55"
            align="center"
          />
          <el-table-column label="房源编号" align="center" prop="roomNum" />
          <el-table-column label="楼层" align="center" prop="floor" />
          <el-table-column label="园区" align="center" prop="parkName" />
          <el-table-column label="楼栋" align="center" prop="buildingName" />
          <el-table-column
            label="房源面积(m²)"
            align="center"
            prop="builtUpArea"
          />
        </el-table>
        <pagination v-show="buiRoomListTotal > 0" :total="buiRoomListTotal" />
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelDevice(typeFee)">取 消</el-button>
        <el-button type="primary" @click="submitDevice(typeFee)"
        >确 定</el-button
        >
      </span>
    </el-dialog>

  </div>
</template>
<script>
import { addFeLeaseRecord } from '@/api/smartParks/operatingFee/leasing'
import {
  listQyEnterprise,
  getQyEnterprise,
  delQyEnterprise,
  addQyEnterprise,
  updateQyEnterprise,
} from "@/api/smartParks/merchants/merchantsCompanySettlein";
import { returntomenu } from '@/utils/common'
import { listZsCustomer } from '@/api/smartParks/merchants/merchantsCustomer'
import { listBuiRoom } from '@/api/parkAssets/buildingRoom' //房源
import { listFeFacility } from '@/api/smartParks/operatingFee/facilities'
import FileUpload from '@/views/smartParks/parkAssets/components/FileUpload'
import {
  listFeApartment,
  addFeApartment1,
  getFeApartmentVO,
  updateFeApartment1
} from '@/api/smartParks/operatingFee/apartment'
import { getDicts } from '@/api/system/dict/data'
import { listBuiPark } from '@/api/parkAssets/enterCommunity'
import { listBuiBuilding } from '@/api/parkAssets/building'
import { listQyEnterpriseType } from '@/api/smartParks/merchants/enterpriseType'
import { listQyEnterpriseProductionType } from '@/api/system/qyEnterpriseProductionType'

export default {
  name: 'PartmentAdd',
  components: {
    FileUpload
  },
  data() {
    return {
      activeNames: ['1', '2', '3', '4'],
      step: [
        {
          to: 'shenqing',
          text: '申请信息'
        },
        {
          to: 'zulin',
          text: '租赁信息'
        },
        {
          to: 'dianjian',
          text: '房源列表'
        },
        {
          to: 'fujian',
          text: '附件'
        }
        // {
        //   to: "dianjian1",
        //   text: "费用选择",
        // },
      ],
      showChooseEnter:false,
      isZz: false,//是否是增租
      chooseEnterTem: {},//企业信息
      zsCustomerList: [], //或缺企业
      qyEnterpriseTypeList: [],
      qyEnterpriseProductionTypes: [],

      stepSelect: 0,
      fileList: [],
      // 表单参数
      form: {
        id: null,
        enterpriseId: null,
        enterpriseName:null,
        enterprise:{
          enterpriseName: null,
          enterpriseId: null,
          contactPhone:null,
          enterpriseContact:null,
          legalPerson:null,
          legalPhone:null,
          remark:null,
        },
        recordType: 1,
        customerId:null,
        apartmentFeeId: null,
        facilityFeeId: null,
        roomIdList: [],
        roomVOList: [],
        fileIdList: [],
        feApartment: {
          beginTime: '',
          endTime: '',
          rentFreeBeginDate: '',
          rentFreeEndDate: '',
          contractArea: '',//总面积
          calculationMode: '自动计费',
          feeModel: '按月',
          leaseModel: '按间',//出租方式
          recordState: '未到期',
          effect: '已生效'

        }
      },
      fileSize: 20,//上传文件大小限制
      // 表单校验
      rules: {
        'enterprise.enterpriseName': [
          { required: true, message: '企业名称不能为空', trigger: 'blur' }
        ],
        'enterprise.enterpriseContact': [
          { required: true, message: '企业联系人不能为空', trigger: 'blur' }
        ],
        // 'feApartment.contractArea': [
        //   { required: true, message: '合同总面积不能为空', trigger: 'blur' }
        // ],
        'enterprise.contactPhone': [
          { required: true, message: '联系人电话不能为空', trigger: 'blur' }
        ]
      },

      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      dialogdeviceVisible: false, //房源
      isdisabled: false,
      loading: false,
      buiRoomList: [], //房源列表
      buiRoomListTotal: '',
      buiRoomListSelectTem: [], //选择的
      buiRoomListSelect: [], //确定的
      title: '', //谈框标题
      typeFee: '', //那种费用
      queryListBuiRoom: {
        parkName: '',
        buildingName: ''
      },
      qyEnterpriseList: [],
    }
  },
  beforeRouteLeave(to, from, next) {
    this.$store.dispatch('tagsView/delView', this.$route)
    next()
  },

  created() {
    const id = this.$route.query.id;
    if (id != null || id != undefined) {
      //查看详情或者编辑
      getFeApartmentVO(id).then(response => {
        this.form = response.data
        //this.open = true;
        this.buiRoomListSelect = this.form.roomVOList
        this.title = '查看公寓租赁记录'
      })
      this.isdisabled = this.$route.query.disabled
    } else {
      //插入
      this.form.enterpriseName = this.$route.query.name
      this.form.enterpriseId = this.$route.query.enId
    }
    this.getZsCustomerList() //列表
    //this.getList() //房源
    this.getParkBuiBuildingList()
    listQyEnterpriseType().then((response) => {
      this.qyEnterpriseTypeList = this.handleTree(response.rows, 'id')
    })
    listQyEnterpriseProductionType().then(res => {
      this.qyEnterpriseProductionTypes = res.rows
    })

  },
  methods: {

    //选择企业
    chooseEnterFn(id) {
      console.log("选择企业：" + id);
      let rItem = this.zsCustomerList.find(item => {
        return item.id == id
      })
      this.chooseEnterTem = rItem
      this.form.enterprise.enterpriseName = this.chooseEnterTem.enterpriseName
      this.form.enterprise.legalPerson = this.chooseEnterTem.legalPerson
      this.form.enterprise.legalPhone = this.chooseEnterTem.legalPhone
      this.form.enterprise.contactPhone = this.chooseEnterTem.contactPhone
      this.form.enterprise.enterpriseContact = this.chooseEnterTem.enterpriseContact
      this.form.enterprise.enterpriseId = this.chooseEnterTem.id
      this.form.enterpriseId = this.chooseEnterTem.id
      this.form.enterpriseName = this.chooseEnterTem.enterpriseName
      this.form.customerId = this.chooseEnterTem.id
      this.showChooseEnter = false
    },

    cancelChooseEnter() {
      this.reset()
      this.chooseEnterTem = null
    },


    getParkBuiBuildingList() {
      listFeApartment().then((response) => {
        this.fePropertyList = response.rows
        this.fePropertyTotal = response.total
        this.loading = false
      })
      if(this.qyEnterpriseList.length<=0){
        listQyEnterprise().then((response) => {
          this.qyEnterpriseList = response.rows;
        });
      }

      //查询园区列表，赋值给parkList;
      listBuiPark().then((response) => {
        this.parkList = response.rows
      })

      listBuiBuilding().then((response) => {
        this.buildingList = response.rows
      })
      this.queryListBuiRoomFn()
    },
    queryListBuiRoomFn() {
      let data = {
        leaseState: 0,
        roomType: '公寓',
        state: '租赁',
        ...this.queryListBuiRoom
      }
      listBuiRoom(data).then((response) => {
        this.buiRoomList = response.rows
        this.buiRoomListTotal = response.total
        this.loading = false
      })
    },
    resetQueryListBuiRoomFn() {
      this.queryListBuiRoom = {
        parkNum: '',
        buildingNum: ''
      }
      this.queryListBuiRoomFn()
    },
    jump(domId, index) {
      this.stepSelect = index
      //页面滚动了的距离
      let height =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop
      let dom = document.getElementById(domId)
      // let domHeight = dom.offsetTop + 60;
      let domHeight = dom.offsetTop - 104
      //滚动距离计算
      var S = Number(height) - Number(domHeight)
      //判断上滚还是下滚
      if (S < 0) {
        //下滚
        S = Math.abs(S)
        window.scrollBy({
          top: S,
          behavior: 'smooth'
        })
      } else if (S == 0) {
        //不滚
        window.scrollBy({
          top: 0,
          behavior: 'smooth'
        })
      } else {
        //上滚
        S = -S
        window.scrollBy({
          top: S,
          behavior: 'smooth'
        })
      }
    },
    changeEnter() {
      if (this.form.customerId) {
        let itemTep = this.zsCustomerList.filter((item) => {
          return item.id == this.form.customerId
        })
        this.form.enterpriseName = itemTep[0].enterpriseName
          ? itemTep[0].enterpriseName
          : undefined
        this.form.enterpriseContact = itemTep[0].enterpriseContact
          ? itemTep[0].enterpriseContact
          : undefined
        this.form.contactPhone = itemTep[0].contactPhone
          ? itemTep[0].contactPhone
          : undefined
        this.form.enterpriseType = itemTep[0].enterpriseType
          ? itemTep[0].enterpriseType
          : undefined
      } else {
        this.form.enterpriseName = undefined
        this.form.enterpriseContact = undefined
        this.form.contactPhone = undefined
        this.form.enterpriseType = undefined
      }
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,

        enterpriseName: null,
        enterpriseId: null,
        enterprise:{
          enterpriseName: null,
          enterpriseId: null,
          contactPhone:null,
          enterpriseContact:null,
          legalPerson:null,
          legalPhone:null,
          remark:null,
        },
        recordType: 1,
        customerId:null,
        apartmentFeeId: null,
        facilityFeeId: null,
        roomIdList: [],
        roomVOList: [],
        fileIdList: [],
        feApartment: {
          beginTime: '',
          endTime: '',
          rentFreeBeginDate: '',
          rentFreeEndDate: '',
          contractArea: '',//总面积
          calculationMode: '自动计费',
          feeModel: '按月',
          leaseModel: '按间',//出租方式
          recordState: '未到期',
          effect: '已生效'

        }
      }
      this.resetForm('form')
    },
    // 取消按钮
    cancel() {
      this.$store.dispatch('tagsView/delView', this.$route)
      this.$router.go(-1)
    },

    //获取列表
    getZsCustomerList() {
      //获取企业列表
      listZsCustomer().then((response) => {
        this.zsCustomerList = response.rows
      })

    },
    getList() {
      let data = {
        leaseState: 0,
        roomType: '公寓',
        state: '租赁'
      }
      listBuiRoom(data).then((response) => {
        this.buiRoomList = response.rows
        this.buiRoomListTotal = response.total
        this.loading = false
      })
      listFeFacility().then((response) => {
        this.feFacilityList = response.rows
        this.feFacilityTotal = response.total
        this.loading = false
      })
      listFeApartment().then((response) => {
        this.fePropertyList = response.rows
        this.fePropertyTotal = response.total
        this.loading = false
      })
      listQyEnterprise(this.queryParams).then((response) => {
        this.qyEnterpriseList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    addDevice(param) {
      this.dialogdeviceVisible = true
      this.typeFee = param
      if (this.typeFee === 'buiRoomList') {
        //todo 查询房源列表
        this.title = '选择房源'
        if (this.buiRoomListSelect.length > 0) {
          this.$refs.buiRoomListRef.clearSelection()
          this.$nextTick(() => {
            this.buiRoomListSelect.forEach((row) => {
              this.$refs.buiRoomListRef.toggleRowSelection(
                this.buiRoomList.find((item) => {
                  return row.id === item.id
                }),
                true
              )
            })
          })
        } else {
          this.$nextTick(() => {
            this.$refs.buiRoomListRef.clearSelection()
          })
        }
      }

      if (this.typeFee === 'property') {
        this.title = '选择公寓计费方式'
        if (this.fePropertyListSel.length > 0) {
          this.$nextTick(() => {
            this.fePropertyListSel.forEach((row) => {
              this.$refs.fePropertyListRef.toggleRowSelection(
                this.fePropertyList.find((item) => {
                  return row.id === item.id
                }),
                true
              )
            })
          })
        } else {
          this.$nextTick(() => {
            this.$refs.fePropertyListRef.setCurrentRow()
          })
        }
      }
    },
    //确定
    submitDevice() {
      this.dialogdeviceVisible = false
      if (this.typeFee === 'buiRoomList') {
        this.buiRoomListSelect = JSON.parse(
          JSON.stringify(this.buiRoomListSelectTem)
        )
      }

      // if (this.typeFee === "facilities") {
      //   let temArr = [this.feFacilityTem];
      //   this.feFacilitySel = JSON.parse(JSON.stringify(temArr));
      // }

      if (this.typeFee === 'property') {
        let temArr = [this.fePropertyListTem]
        this.fePropertyListSel = JSON.parse(JSON.stringify(temArr))
      }
    },
    getRowKey(row) {
      return row.id
    },
    // //选择房源
    handleDevice(val) {
      if (this.typeFee === 'buiRoomList') {
        this.buiRoomListSelectTem = val
      }

      // if (this.typeFee === "facilities") {
      //   this.feFacilityTem = val;
      // }

      if (this.typeFee === 'property') {
        this.fePropertyListTem = val
      }
    },

    delDevice(param, index) {
      if (param === 'buiRoomList') {
        this.buiRoomListSelect.splice(index, 1)
      }

      // if (param === "facilities") {
      //   this.feFacilitySel = [];
      // }

      if (param === 'property') {
        this.fePropertyListSel = []
      }
    },

    cancelDevice() {
      this.dialogdeviceVisible = false
    },

    /** 提交按钮 */
    submitForm: function() {

      this.form.roomIdList = this.buiRoomListSelect.map((item) => {
        return item.id
      })
      this.form.roomVOList = this.buiRoomListSelect
      this.$refs['form'].validate((valid) => {
        if (valid) {
          let data = JSON.parse(JSON.stringify(this.form))
          data.fileIdList = this.$refs.fileupload.fileList.map(
            (item) => item.id
          )
          if (this.form.feApartment.id != undefined) {
            //更新
            updateFeApartment1(data).then((response) => {
              if (response.code === 200) {
                this.msgSuccess('修改成功')
                setTimeout(() => {
                  returntomenu(this)
                }, 1000)
              }
            })
          } else {
            //console.log(data);
            addFeApartment1(data).then((response) => {
              if (response.code === 200) {
                this.msgSuccess('修改成功')
                setTimeout(() => {
                  this.$store.dispatch('tagsView/delView', this.$route)
                  this.$router.go(-1)
                }, 2000)
              }
            })
          }
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-select,
.el-date-editor {
  width: 100%;
}

.big-foot-fixed {
  text-align: center;
  padding-bottom: 20px;
}

.cgjhadd {
  overflow: hidden;
  background: #f7f8f8;
  min-height: calc(100vh - 84px);
  height: auto;

  .top {
    height: 40px;
    box-sizing: border-box;
    background: #409eff !important;
    color: #fff;
    padding-left: 20px;
    display: flex;
    align-items: center;
    font-size: 12px;
    justify-content: space-between;

    .submit {
      padding: 3px 10px;
      border-radius: 10px;
      background: #fff;
      color: #409eff;
      cursor: pointer;
      margin-right: 100px;
    }
  }
}

.contain {
  height: auto !important;
  margin: 20px 20px 0px 20px;
  padding-bottom: 20px;
  display: flex;

  .left {
    .text-height {
      height: 80px;

      ::v-deep .el-form-item__content {
        height: 80px;
      }
    }

    .lrAbout {
      display: flex;
      justify-content: space-between;
    }

    width: 90%;

    ::v-deep .el-collapse {
      border-bottom: 0px;
    }

    ::v-deep .el-collapse-item {
      background: #fff;
      font-size: 12px;
      margin-bottom: 20px;

      .el-collapse-item__header,
      .el-collapse-item__wrap {
        background: "";
      }

      .el-collapse-item__header {
        position: relative;
        height: 44px;
        padding-left: 20px;
      }

      .el-collapse-item__header:before {
        position: absolute;
        content: "";
        width: 2px;
        height: 18px;
        background-color: #409eff;
        left: 0;
        top: 13px;
      }

      .el-collapse-item__wrap {
        border-top: 1px solid #e6ebf5;
      }

      .el-collapse-item__content {
        padding-top: 25px;
      }

      .form-box1 {
        width: 100%;
        padding: 0 20px;

        .el-button {
          margin-top: 10px;
        }

        .el-button:first-child {
          margin-top: -10px;
        }

        .el-table {
          margin-top: 10px;
        }
      }

      .form-box {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        padding: 0 20px;

        .el-form-item {
          width: 48%;
        }

        .el-form-item__label {
          font-size: 12px;
          font-weight: normal;
        }

        .el-form-item:nth-child(2n) {
          margin-left: 4%;
        }
      }
    }

    ::v-deep .avatar-uploader .el-upload {
      border: 1px dashed #d9d9d9;
      border-radius: 6px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
    }

    ::v-deep .avatar-uploader .el-upload:hover {
      border-color: #409eff;
    }

    ::v-deep .avatar-uploader-icon {
      font-size: 28px;
      color: #8c939d;
      width: 178px;
      height: 178px;
      line-height: 178px;
      text-align: center;
    }

    ::v-deep .avatar {
      width: 178px;
      height: 178px;
      display: block;
    }
  }

  .right {
    width: 10%;

    .my-steps-box {
      font-size: 12px;
      position: fixed;
      right: 30px;
      // top: 104px;
      .step-item {
        margin-bottom: 30px;
        position: relative;

        .top-title {
          display: flex;
          cursor: pointer;

          .cricle {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            margin-right: 5px;
            background: #e8eaec;
            box-sizing: border-box;
            // background: red;
            border: 2px solid #f7f8f8;
          }
        }

        .line {
          position: absolute;
          width: 2px;
          height: 30px;
          top: 12px;
          left: 5px;
          background: #e8eaec;
        }
      }

      .step-item.step-active {
        .cricle {
          border: 2px solid #d5e7f9;
          background-color: #2d8cf0;
        }

        .text {
          color: #2d8cf0;
        }
      }

      .step-item:nth-last-child(1) .line {
        display: none;
      }
    }
  }
}
</style>
